package com.allnas.springcloud.web;

import com.allnas.springcloud.entity.User;
import com.allnas.springcloud.service.ProducerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zhaojin
 */
@Slf4j
@RequestMapping("user2")
@RestController
public class User2Controller {

    @Resource
    private ProducerService producerService;

    @GetMapping("query/{id}")
    public User query(@PathVariable Integer id) {
        log.info("id:{}", id);
       return producerService.query(id);
    }

    @PostMapping("check")
    public String check(User user) {
        log.info("user:{}", user);
        return producerService.check(user);
    }
}
